package com.wmz.picture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wmz.picture.model.dto.picture.*;
import com.wmz.picture.model.entity.Picture;
import com.wmz.picture.model.entity.User;
import com.wmz.picture.model.vo.PictureVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author 11861
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2024-12-17 20:53:06
*/
public interface PictureService extends IService<Picture> {
    /**
     * 上传图片
     * @param inputSource     文件
     * @param pictureUploadRequest  图片ID
     * @param loginUser     当前登录用户
     * @return  上传后的图片信息
     */

    PictureVO uploadPicture(Object inputSource, PictureUploadRequest pictureUploadRequest, User loginUser);

    /**
     * 批量上传图片
     * @param pictureUploadBatchRequest 批量上传请求类
     * @param loginUser 登录用户
     * @return  批量上传的图片数量
     */
    Integer uploadPictureBatch(PictureUploadBatchRequest pictureUploadBatchRequest,User loginUser);

    /**
     * 获取单个图片封装类
     * @param picture   原图片信息
     * @param request
     * @return
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 分页获取图片封装
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);
    /**
     * 构造查询请求器
     * @param pictureQueryRequest 查询请求DTO
     * @return
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 删除图片
     * @param pictureId
     * @param loginUser
     */
    void deletePicture(long pictureId, User loginUser);
    /**
     * 编辑图片
     * @param pictureEditRequest
     * @param loginUser
     */
    void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

    /**
     * 图片校验
     * @param picture
     */
    void validPicture(Picture picture);

    /**
     * 图片审核
     * @param pictureReviewRequest
     * @param loginUser
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest,User loginUser);

    /**
     * 补充审核参数
     * @param picture 图片实体类
     * @param loginUser 用户
     */
    void fillReviewParams(Picture picture,User loginUser);

    /**
     * 清理图片
     * @param oldPicture
     */
    void clearPictureFile(Picture oldPicture);

    /**
     * 校验图片权限
     * @param loginUser
     * @param picture
     */
    void checkPictureAuth(User loginUser,Picture picture);
}
